package com.gzhu.knowledgeAdmin.service.impl;

import com.gzhu.knowledgeAdmin.common.dto.type.TypeAddRequest;
import com.gzhu.knowledgeAdmin.repository.AnswerTypeRepository;
import com.gzhu.knowledgeAdmin.entity.AnswerType;
import com.gzhu.knowledgeAdmin.service.AnswerTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class AnswerTypeServiceImpl implements AnswerTypeService {

    @Autowired
    private AnswerTypeRepository answerTypeRepository;

    @Override
    public List<String> getAnswerTypeList() {

        List<AnswerType> answerTypeList = answerTypeRepository.findAll();

        return answerTypeList.stream().map(AnswerType::getName).collect(Collectors.toList());
    }

    @Override
    public List<AnswerType> getAllAnswerTypeList() {
        return answerTypeRepository.findAll();
    }

    @Override
    public void addAnswerType(TypeAddRequest typeAddRequest) {
        //TODO
    }

    @Override
    public void deleteAnswerType(List<Integer> idList) {
        //TODO
    }

}
